<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>bind指令</title>
    <style>
        .box1 {
            width: 300px;
            height: 300px;
            background-color: skyblue;
        }

        .box2 {
            width: 300px;
            height: 300px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div id="app">
        <div v-bind:class=" num>20? id+1: id+2">

        </div>
        <div v-bind:class="style_list[0]">
            <button onclick="test()">点击</button>
        </div>

        <div>
            <a v-bind:href="status?url[0]:url[1]">{{status?msg[0]:msg[1]}}</a>
        </div>
    </div>
</body>
<script src=" https://cdn.jsdelivr.net/npm/vue@2.6.14">
</script>
<script>
    // 实例化Vue对象
    let app = new Vue({
        el: '#app',         // Vue对象在页面中的作用容器
        // 当前Vue对象设置的默认数据
        data: {
            num: 10,
            id: 'box',
            style_list: [
                'box1',
                'box2'
            ],
            url: [
                'user.html',
                'login.html'
            ],
            msg: [
                '个人中心',
                '登录页'
            ],
            status: false
        }

    })

    console.log(app.num)
    setTimeout(() => {
        app.num = 100
        app.status = true
    }, 3000)   
</script>

</html>